package model;

import java.util.ArrayList;
import java.util.List;

import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;

import entidade.Divisao;

@SuppressWarnings({ "rawtypes", "serial" })
public class DivisaoComboBoxModel extends AbstractListModel implements
ComboBoxModel {
	 private Object selectedItem;
     private List<Divisao> list;

     public DivisaoComboBoxModel() {
             list = new ArrayList<Divisao>();
     }

     public DivisaoComboBoxModel(List<Divisao> lista) {
             this();
             list.addAll(lista);
     }

     @Override
     public int getSize() {
             return list.size();
     }

     @Override
     public Divisao getElementAt(int index) {
             Divisao d = list.get(index);
             return d;
     }

     @Override
     public void setSelectedItem(Object anItem) {
             selectedItem = anItem;
     }

     @Override
     public Object getSelectedItem() {
             return selectedItem;
     }

}
